package cn.nubia.admin.api.zuimeia.transport;

import cn.nubia.admin.common.http.HttpClientReq;
import org.codehaus.jackson.type.TypeReference;

/**
 * Created by Administrator on 2015/7/24.
 */
public class AppsReq {
    private Integer pageSize;

    private Integer pageNo;

    private String url;

    public AppsReq(String url,Integer pageNo,Integer pageSize) {
        this.pageSize = pageSize;
        this.pageNo = pageNo;
        this.url = url;
    }

    private String getAddress() {
        StringBuilder sb = new StringBuilder();
        sb.append(url).append("?").append("page=").append(pageNo).append("&page_size=").append(pageSize);
        return sb.toString();
    }


    public  AppsResp send() {
        HttpClientReq httpClientReq = HttpClientReq.build(getAddress());
        AppsResp resp = httpClientReq.getForObject(new TypeReference<AppsResp>() { });
        return resp;
    }


    public static void main(String[] args) {
        AppsReq appsReq = new AppsReq("http://zuimeia.com/api/resource/nubia/",1,20);
        AppsResp resp = appsReq.send();
        System.out.println(resp);
    }
}